﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                    xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
                    xmlns:interactivity="clr-namespace:WirelessAccessPoint.Interactivity"
                    xmlns:resources="clr-namespace:WirelessAccessPoint.Resources">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Style/BaseStyle.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="CellLabelStyle" TargetType="{x:Type Label}">
        <Setter Property="BorderBrush" Value="{StaticResource CellBorderBrush}" />
        <Setter Property="BorderThickness" Value="0,0,1,1" />
        <Setter Property="Foreground" Value="{StaticResource CellForegroundBrush}" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="Padding" Value="10,7,10,7" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding Path=(Grid.Row), RelativeSource={RelativeSource Self}, Converter={StaticResource Int32ToMod2Converter}}" Value="0">
                <Setter Property="Background" Value="{StaticResource CellEvenBackgroundBrush}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding Path=(Grid.Row), RelativeSource={RelativeSource Self}, Converter={StaticResource Int32ToMod2Converter}}" Value="1">
                <Setter Property="Background" Value="{StaticResource CellOddBackgroundBrush}" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="CellImageLabelStyle" TargetType="{x:Type Label}">
        <Setter Property="Margin" Value="0,0,5,0" />
        <Setter Property="FontFamily" Value="/Resources/#FontAwesome" />
        <Setter Property="Foreground" Value="{StaticResource CellImageTitleForegroundBrush}" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
    </Style>
    
    <Style x:Key="CellTitleLabelStyle" TargetType="{x:Type Label}">
        <Setter Property="Foreground" Value="{StaticResource CellImageTitleForegroundBrush}" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
    </Style>

    <Style TargetType="{x:Type ToolTip}">
        <Setter Property="Background" Value="{StaticResource ErrorBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource ErrorBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToolTip">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="3"
                            Margin="0,0,2,2"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                            VerticalAlignment="{TemplateBinding VerticalAlignment}">
                        <Border.Effect>
                            <DropShadowEffect Color="#000000"
                                                    Direction="315"
                                                    ShadowDepth="1"
                                                    Opacity="0.5" /> 
                        </Border.Effect>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="&#xF06A;"
                                   FontFamily="/Resources/#FontAwesome"
                                   FontSize="14"
                                   Foreground="#AA0000"
                                   Margin="5,5,5,5"
                                   Padding="0"
                                   SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                   VerticalAlignment="Center"
                                   VerticalContentAlignment="Center" />
                            <Label Foreground="{StaticResource ErrorForegroundBrush}"
                                   Padding="0"
                                   Margin="0,0,5,0"
                                   SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                   VerticalAlignment="Center"
                                   VerticalContentAlignment="Center">
                                <ContentPresenter />
                            </Label>
                        </StackPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="{x:Type TextBox}">
        <Setter Property="FontSize" Value="12" />
        <Setter Property="Height" Value="24" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="InputMethod.IsInputMethodSuspended" Value="True" />
        <Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
        <Setter Property="interactivity:InteractionForStyle.Behaviors">
            <Setter.Value>
                <interactivity:BehaviorForStyleCollection>
                    <interactivity:SelectAllTextBoxBehavior />
                    <interactivity:TrimTextBoxBehavior />
                    <interactivity:EmptyToNullTextBoxBehavior />
                </interactivity:BehaviorForStyleCollection>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="True">
                <Setter Property="ToolTip" Value="{Binding (Validation.Errors)[0].ErrorContent, RelativeSource={RelativeSource Self}}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type PasswordBox}">
        <Setter Property="FontSize" Value="12" />
        <Setter Property="Height" Value="24" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="InputMethod.IsInputMethodSuspended" Value="True" />
        <Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
        <Setter Property="interactivity:InteractionForStyle.Behaviors">
            <Setter.Value>
                <interactivity:BehaviorForStyleCollection>
                    <interactivity:SelectAllPasswordBoxBehavior />
                    <interactivity:TrimPasswordBoxBehavior />
                    <interactivity:EmptyToNullPasswordBoxBehavior />
                </interactivity:BehaviorForStyleCollection>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type CheckBox}">
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
    </Style>

    <Style TargetType="{x:Type ComboBox}">
        <Setter Property="FontSize" Value="12" />
        <Setter Property="Height" Value="24" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="True">
                <Setter Property="ToolTip" Value="{Binding (Validation.Errors)[0].ErrorContent, RelativeSource={RelativeSource Self}}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type ListBox}">
        <Setter Property="BorderThickness" Value="0" />
    </Style>
    
    <Style x:Key="PeerImageStyle" TargetType="{x:Type Image}">
        <Setter Property="Margin" Value="8,5,8,5" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Source" Value="/Resources/HostedNetworkPeer.png" />
        <Setter Property="Stretch" Value="None" />
        <Setter Property="VerticalAlignment" Value="Center" />
    </Style>

    <Style x:Key="PeerLabelStyle" TargetType="{x:Type Label}">
        <Setter Property="Foreground" Value="{StaticResource CellForegroundBrush}" />
        <Setter Property="Margin" Value="0,0,8,0" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
    </Style>

</ResourceDictionary>
